import { Injectable } from '@nestjs/common';

@Injectable()
export class FormatService {
  // 成功响应
  success(data: any, message: string = '请求成功') {
    return {
      code: 200,
      data,
      message,
    };
  }

  // 失败响应
  error(message: string, code: number = 500) {
    return {
      code,
      data: null,
      message,
    };
  }
}
